home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / System / ReqToolsLib / Source / reqtools / rtspread.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-07-02  |  2.2 KB  |  96 lines

  1.  
  2. /*
  3.     (C) 1999 AROS - The Amiga Research OS
  4.     $Id: rtspread.c,v 1.6 2001/04/12 09:11:47 iaint Exp $
  5.  
  6.     Desc:
  7.     Lang: English
  8. */
  9.  
  10. #include <exec/types.h>
  11. #include <proto/exec.h>
  12. #include <proto/reqtools.h>
  13. #include <exec/libraries.h>
  14. #include <exec/memory.h>
  15. #include <aros/libcall.h>
  16. #include "general.h"
  17. #include "reqtools_intern.h"
  18. #include "rtfuncs.h"
  19.  
  20. /*****************************************************************************
  21.  
  22.     NAME */
  23.  
  24.     AROS_LH6(VOID, rtSpread,
  25.  
  26. /*  SYNOPSIS */
  27.  
  28.     AROS_LHA(ULONG *, posarray , A0),
  29.     AROS_LHA(ULONG *, sizearray, A1),
  30.     AROS_LHA(ULONG  , totalsize, D0),
  31.     AROS_LHA(ULONG  , min      , D1),
  32.     AROS_LHA(ULONG  , max      , D2),
  33.     AROS_LHA(ULONG  , num      , D3),
  34.  
  35. /*  LOCATION */
  36.  
  37.     struct ReqToolsBase *, ReqToolsBase, 22, ReqTools)
  38.  
  39. /*  FUNCTION
  40.     Evenly spread a number of objects over a certain length.
  41.     Primary use is for arrangement of gadgets in a window.
  42.  
  43.     INPUTS
  44.     posarray - pointer to array to be filled with positions.
  45.     sizearray - pointer to array of sizes.
  46.     totalsize - total size of all objects (sum of all values in
  47.         sizearray).
  48.     min - first position to use.
  49.     max - last position, first _NOT_ to use.
  50.     num - number of objects (size of posarray and sizearray).
  51.  
  52.     RESULT
  53.     none
  54.  
  55.     NOTES
  56.     This function is for the advanced ReqTools user.
  57.  
  58.     EXAMPLE
  59.     'sizearray' holds following values: 4, 6, 4, 2 and 8,
  60.     'totalsize' is 24 (= 4 + 6 + 4 + 2 + 8),
  61.     'min' is 3, 'max' is 43,
  62.     and finally, 'num' is 5.
  63.  
  64.     After calling rtSpread() 'posarray' would hold the following
  65.     values: 3, 11, 19, 26 and 31.
  66.  
  67.     My attempt at a visual representation:
  68.  
  69.             |                                            |
  70.             |  |                                      |  |
  71.             |  OOOO    OOOOOO    OOOO    OO    OOOOOOOO  |
  72.             |  |                                      |  |
  73.             |         1    1    2    2    3    3    4    4
  74.             0----5----0----5----0----5----0----5----0----5
  75.  
  76.     BUGS
  77.     none known
  78.  
  79.     SEE ALSO
  80.  
  81.     INTERNALS
  82.  
  83.     HISTORY
  84.  
  85. ******************************************************************************/
  86. {
  87.     AROS_LIBFUNC_INIT
  88.  
  89.     RTFuncs_rtSpread(posarray, sizearray, totalsize, min, max, num);
  90.  
  91.     AROS_LIBFUNC_EXIT
  92.     
  93. } /* rtSpread */
  94.  
  95.  
  96.